<?php

class Application_Model_Course
{
	protected $_gpNum;
	protected $_pilote;
	protected $_tempsCourse;

	public function __construct(array $options = null)
	{
		if(is_array($options))
		{
			$this->setOptions($options);
		}
	}
	
	public function __set($name, $value)
	{
		$method = 'set' . $name;
		if(('mapper' == $name) || !method_exists($this, $method))
		{
			throw new Exception('Invalid course property');
		}
		$this->$method($value);
	}
	public function __get($name)
	{
		$method = 'get' . $name;
		if(('mapper' == $name) || !method_exists($this, $method))
		{
			throw new Exception('Invalid course property');
		}
		return $this->$method();
	}

	public function setOptions(array $options)
	{
		$methods = get_class_methods($this);
		foreach ($options as $key => $value)
		{
			$method = 'set' . ucfirst($key);
			if(in_array($method, $methods))
			{
				$this->$method($value);
			}
		}
		return $this;
    }
	
	public function setGpNum($gpNum)
	{
		$this->_gpNum = (int)$gpNum;
		return $this;
	}
	public function getGpNum()
	{
		return $this->_gpNum;
	}

	public function setPilote($pilote)
	{
		$this->_pilote = $pilote;
		return $this;
	}
	public function getPilote()
	{
		return $this->_pilote;
	}

	public function setTempsCourse($tempsCourse)
	{
		$this->_tempsCourse = (string)$tempsCourse;
		return $this;
	}
	public function getTempsCourse()
	{
		return $this->_tempsCourse;
	}
}